﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PacManPP.Managers;
using Microsoft.Xna.Framework;

namespace PacManPP.Objects
{
    class Dot : IObject
    {

        public Boolean eat_by_pacman = false;
        public Boolean killed = false;
        public Dot(int x, int y)
        {

            startFrame = 18;
            maxFrame = 18;
            move = 5;
            spirteSheetName = "dot";
            Position = new Vector2(x,y);
            poistion.X = poistion.X + GameManager.scale / 2 - 5;
            poistion.Y = poistion.Y + GameManager.scale / 2 - 1;

            

        }

        static public List<Dot> Generate(int x, int y)
        {
            List<Dot> list = new List<Dot>();

            for (int i = (int)GameManager.boardBegin.X; i <=x; i++)
                for (int j = (int)GameManager.boardBegin.Y; j <= y; j++)
                {
                    System.Console.WriteLine((int)GameManager.boardSize.Y / 2);
                    if (i == (int)GameManager.boardBegin.X && j == (int)GameManager.boardBegin.Y) continue;
                    if (i == ((int)GameManager.boardSize.X / 2 - 1) && j == (int)GameManager.boardSize.Y / 2) continue;
                    if (i == ((int)GameManager.boardSize.X / 2) && j == (int)GameManager.boardSize.Y / 2) continue;
                    if (i == ((int)GameManager.boardSize.X / 2 + 1) && j == (int)GameManager.boardSize.Y / 2) continue;
                    if (i == ((int)GameManager.boardSize.X / 2 + 2) && j == (int)GameManager.boardSize.Y / 2) continue; 
                        
                    list.Add(new Dot(i, j));
                }

            return list;
        }

        public override void HandleInput(Microsoft.Xna.Framework.Input.KeyboardState keyboardState)
        {
            //base.HandleInput(keyboardState);
        }

        public override void Draw(GameTime gameTime)
        {
            Rectangle source1 = new Rectangle(9 ,  9 , 8, 8);
            Rectangle rect = new Rectangle((int)Position.X, (int)Position.Y, 6, 6);

            spriteBatch.Draw(sprite, rect, source1, Color.White);
        }

      
    }
}
